package cn.isjinhao.se.sql.grammar.statement.retrieve.represention;

import cn.isjinhao.se.sql.grammar.CurdStatementVisitor;
import cn.isjinhao.se.sql.grammar.CurdStatement;
import cn.isjinhao.se.sql.grammar.statement.Unary;
import cn.isjinhao.se.sql.lexical.token.Token;

/**
 * @author 01395265
 * @date 2021/3/3
 */
public class TableRep extends Unary {

    private Token as;

    /**
     * operator是别名，selectStatement是真实表
     */
    public TableRep(CurdStatement curdStatement, Token operator, Token as) {
        super(operator, curdStatement);
        this.as = as;
    }

    /**
     * selectStatement是真实表
     */
    public TableRep(CurdStatement curdStatement) {
        super(null, curdStatement);
    }



    @Override
    public <R> R accept(CurdStatementVisitor<R> curdStatementVisitor) {
        return curdStatementVisitor.visitTableRep(this);
    }

    public Token getAs() {
        return as;
    }
}
